<?php

namespace app\common;

enum LoginType: int
{
    case LOGIN_TYPE_WECHAT = 1;
    case LOGIN_TYPE_PHONE = 2;
    case LOGIN_TYPE_QQ = 3;
    case LOGIN_TYPE_APPLE = 4;
    case LOGIN_TYPE_WEIBO = 5;
    case LOGIN_TYPE_TOURIST = 6;
    case LOGIN_TYPE_WECHATAPP = 7;

    public function getStatus(): string
    {
        return match ($this) {
            self::LOGIN_TYPE_WECHAT => '微信',
            self::LOGIN_TYPE_PHONE => '手机号',
            self::LOGIN_TYPE_QQ => 'QQ',
            self::LOGIN_TYPE_APPLE => 'AppleID',
            self::LOGIN_TYPE_WEIBO => '微博',
            self::LOGIN_TYPE_TOURIST => '游客',
            self::LOGIN_TYPE_WECHATAPP => '微信小程序',
        };
    }

    public static function values(): array
    {
        $notes = [];
        $array = array_column(self::cases(), 'value');
        foreach ($array as $value) {
            $notes[$value] = self::from($value)->getStatus();
        }
        return $notes;
    }
}